package com.apps.java.javanote;

public class _7面向对象案例 {

    //成员变量: 数据类型  变量;
	/*String brand;
	int price;

	//成员方法
	public void call(){
		System.out.println(brand+"手机打电话");
	}
	public void sendMessage(){
		System.out.println(brand+"手机发短信");
	}


	public static void main(String[] args) {
		_7面向对象案例iPhone ip = new _7面向对象案例iPhone();

	}
	*/




	/*
	//封装成员变量
	private String name;
	private int age;
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public int getAge() {
		return age;
	}
	public void setAge(int age) {
		this.age = age;
	}
	*/




	/*
	public void setName(String name){
		this.name = name;
	}
	public String getName(){
		return name;
	}

	public void setAge(int age){
		if(a<0 || a>130){
			System.out.println("你的年龄不准确");
		}else {
			this.age = age;
		}
	}
	public int getAge(){
		return age;
	}
	*/

	/*
	//构造方法
	private String name;
	private int age;

	//无参构造方法
	public _7面向对象案例(){
		System.out.println("无参构造方法");
	}

	//有参构造方法
	public _7面向对象案例(String name,int age){
		this.name = name;
		this.age = age;
		System.out.println("有参构造方法 ");
	}

	public void show(){
		System.out.println("姓名："+name+",年龄："+age);
	}

	public static void main(String[] args) {
		_7面向对象案例 is = new _7面向对象案例();
		is.show();
	}
	*/




    //标准类制作
    private String name;
    private int age;

    //无参构造方法
    public _7面向对象案例(){}

    //带参构造方法
    public _7面向对象案例(String name,int age){
        this.name = name;
        this.age = age;
    }
    //成员方法
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public int getAge() {
        return age;
    }
    public void setAge(int age) {
        this.age = age;
    }

    public void show(){
        System.out.println("name:"+name+","+"age:"+age);
    }
}
